package collection1;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo2 {
    public static void main(String[] args) {
        Collection<Point> c2=new ArrayList<>();
        c2.add(new Point(1,2));
        c2.add(new Point(3,4));
        c2.add(new Point(5,6));
        c2.add(new Point(7,8));
        c2.add(new Point(9,0));
        c2.add(new Point(1,2));
        System.out.println(c2);
        Point p2=new Point(7,9);
        boolean contains2=c2.contains(p2);
        System.out.println("是否包含:"+contains2);//fasle
        p2.setY(8);
        System.out.println(p2);
        boolean contains3=c2.contains(p2);
        System.out.println("是否包含:"+contains3);//true
        c2.remove(p2);
        System.out.println(c2);

        Collection<Point> cc2=new ArrayList<>();
        Point pp2=new Point(50,60);
        cc2.add(pp2);
        System.out.println(pp2);
        System.out.println(cc2);
        pp2.setY(100);
        System.out.println(pp2);
        System.out.println(cc2);


        /*
        Collection<String> c2=new ArrayList<>();
        c2.add("one");
        c2.add("two");
        c2.add("three");
        c2.add("four");
        c2.add("five");
        System.out.println(c2);
        System.out.println("元素个数为:"+c2.size());
        System.out.println("集合是否为空集:"+c2.isEmpty());
        c2.clear();
        System.out.println(c2);
        System.out.println("元素个数为:"+c2.size());
        System.out.println("集合是否为空集:"+c2.isEmpty());

         */
    }
}
